<?php

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

class table_tool_info extends discuz_table{
	public function __construct() {

		$this->_table = 'tool_info';
		$this->_pk    = 'tool_id';
		parent::__construct();
	}

	public function get_tool_list($page){
		$result = DB::fetch_all('SELECT * FROM %t WHERE tool_state = %d ORDER BY '.DB::order('tool_time','DESC').DB::limit($page*3-3,3),array($this->_table,20));
		return $result;
	}

	public function count_tool_info(){
		$result = DB::result_first('SELECT COUNT(*) FROM %t',array($this->_table));
		return $result;
	}

	public function add_tool($add_tool){
		$result = DB::insert($this->_table,$add_tool);
		return $result;
	}
}